<template>
  <div class="tab-layout">
    <div class="tab-layout-in">
      <div class="navbar-title">
        {{ componentData[`title${capitalizeLang}`] }}
      </div>
      <div class="navbar-box">
        <div
          v-for="(item, index) in componentData.list"
          :key="index"
          class="navbar-in"
          :class="{ active: currentNavbar === index }"
          @click="currentNavbar = index"
        >
          {{ item[`title${capitalizeLang}`] }}
        </div>
      </div>
      <div class="navbar-content">
        <div v-for="(item, index) in currentDetail" :key="index" class="n-c-row">
          <p class="n-c-label">{{ item[`name${capitalizeLang}`] }}</p>
          <p>{{ item[`value${capitalizeLang}`] }}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  props: {
    componentData: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      currentNavbar: 0,
    }
  },
  computed: {
    ...mapGetters(['capitalizeLang']),
    currentDetail() {
      return this.componentData.list[this.currentNavbar]?.detail || []
    },
  },
}
</script>

<style lang="less" scoped>
@import '~assets/var';

.tab-layout {
  background-color: #121214;

  .tab-layout-in {
    .width(1200);
    .pd(60, 0, 80, 0);
    color: #fff;
    margin: 0 auto;

    .navbar-title {
      .ft(30);
      font-weight: bold;
    }

    .navbar-box {
      .mg(20, 0, 10, 0);
      display: flex;
      border-bottom: 1px solid #5f6268;
    }

    .navbar-in {
      .mg(0, 15, 0, 15);
      .lineH(36);
      .ft(18);
      align-items: center;
      display: flex;
      flex-direction: column;
      cursor: pointer;
      border-bottom: 1px solid #121214;

      &.active {
        border-bottom: 1px solid #fff;
      }

      &:nth-child(1) {
        margin: 0;
      }

      &:nth-child(2) {
        .mg(0, 15, 0, 30);
      }
    }

    .navbar-content {
      min-height: 100px;

      .n-c-row {
        display: flex;
        background-color: #4c5055;
        .ft(18);
        .height(52);
        .lineH(52);
        .mg(20, 0, 0, 0);
      }

      p {
        .pd(0, 0, 0, 20);
      }

      .n-c-label {
        .width(320);
        border-right: 1px solid #121214;
      }
    }
  }
}
</style>
